package cn.labbook.bluetooth.entity.excel;

import cn.labbook.bluetooth.constant.AmmeterConstant;
import cn.labbook.bluetooth.entity.Ammeter;
import cn.labbook.bluetooth.entity.TenantPay;
import cn.labbook.bluetooth.util.GenerateIdUtils;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Date;

@Data
@Accessors(chain = true)
public class PayTemplate {
    private String ammeterId;
    private double price;
    public static PayTemplate build(Ammeter ammeter) {
        PayTemplate payTemplate = new PayTemplate();
        payTemplate.setAmmeterId(ammeter.getAmmeterId());
        payTemplate.setPrice(0.0);
        return payTemplate;
    }
    public TenantPay buildPay(PayTemplate payTemplate){
        TenantPay tenantPay = new TenantPay();
        tenantPay.setTenantPayId(GenerateIdUtils.get32Varchar());
        tenantPay.setPayTime(new Date());
        tenantPay.setAmmeterId(payTemplate.ammeterId);
        tenantPay.setPayAmouont(payTemplate.price);
        tenantPay.setPayStatus(2);
        return tenantPay;
    }
}
